﻿		HMODULE hDLL = ::GetModuleHandleW(XXXXXX);

		IMAGE_IMPORT_DESCRIPTOR *pImportDescriptor = NULL;
		{
			ULONG ImportDescriptorTableSize;
			IMAGE_IMPORT_DESCRIPTOR *ImportDescriptorTable = static_cast<IMAGE_IMPORT_DESCRIPTOR *>(::ImageDirectoryEntryToData(hDLL, TRUE, IMAGE_DIRECTORY_ENTRY_IMPORT, &ImportDescriptorTableSize));
			for (ULONG i = 0U; i < (ImportDescriptorTableSize / sizeof(IMAGE_IMPORT_DESCRIPTOR)); ++i)
			{
				char *NameDLL = reinterpret_cast<char *>(reinterpret_cast<ULONG_PTR>(hDLL) + ImportDescriptorTable[i].Name);//RVA
				if (::strcmp(NameDLL, XX"JustForExample.dll") == 0)
				{
					pImportDescriptor = ImportDescriptorTable + i;
					break;
				}
			}
		}

		ASSERT(pImportDescriptor != NULL);

        //Just For Example
		struct {
			char const *Name;
			ULONG_PTR Address;
		} const HookTable[] = {
			{ "g_OpenFile",reinterpret_cast<ULONG_PTR>(&s_Hook_OpenFile) },
			{ "g_GetFullPath",reinterpret_cast<ULONG_PTR>(&s_Hook_GetFullPath) },
			{ "g_IsFileExist",reinterpret_cast<ULONG_PTR>(&s_Hook_IsFileExist) },
			{ "g_OpenIniFile",reinterpret_cast<ULONG_PTR>(&s_Hook_OpenIniFile) }
		};

		for (auto const &Hook : HookTable)
		{
			ULONG_PTR *pFunctionAddress = NULL;
			{
				IMAGE_THUNK_DATA *ImportNameTable = reinterpret_cast<IMAGE_THUNK_DATA *>(reinterpret_cast<ULONG_PTR>(hDLL) + pImportDescriptor->OriginalFirstThunk);//RVA
				IMAGE_THUNK_DATA *ImportAddressTable = reinterpret_cast<IMAGE_THUNK_DATA *>(reinterpret_cast<ULONG_PTR>(hDLL) + pImportDescriptor->FirstThunk);//RVA

				ULONG i = 0U;
				//RVA 0 -> Table 逾尾
				while (ImportNameTable[i].u1.AddressOfData != 0U)
				{
					char *NameFunction = reinterpret_cast<char *>(reinterpret_cast<IMAGE_IMPORT_BY_NAME *>(reinterpret_cast<ULONG_PTR>(hDLL) + ImportNameTable[i].u1.AddressOfData)->Name);//RVA
					if (::strcmp(NameFunction, Hook.Name) == 0)
					{
						pFunctionAddress = &ImportAddressTable[i].u1.Function;
						break;
					}
					++i;
				}
			}

			ASSERT(pFunctionAddress != NULL);

			DWORD flOldProtect1;
			::VirtualProtect(pFunctionAddress, sizeof(ULONG_PTR), PAGE_WRITECOPY, &flOldProtect1);

			*pFunctionAddress = Hook.Address;

			DWORD flOldProtect2;
			::VirtualProtect(pFunctionAddress, sizeof(ULONG_PTR), flOldProtect1, &flOldProtect2);
		}